## -------------------------------------------------- #
## Schiff, Schiff, Bueno_README
## -------------------------------------------------- #


Date: 10-07-2023

Authors: Kaylyn Jackson Schiff, Daniel S. Schiff, Natália S. Bueno

Title: The Liar's Dividend: Can Politicians Allege Misinformation to Avoid Accountability?

Contact Information: Kaylyn Jackson Schiff <schiffk@purdue.edu>


Copyright (c) 2022, under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.
 For more information see: http://creativecommons.org/licenses/by-nc-sa/3.0/us/
 All rights reserved. 


## -------------------------------------------------- #

This file describes the contents of the replication archive used to conduct the analyses in the main text and appendix. 


## -------------------------------------------------- #


R Information:

The files in the Liar's Dividend Replication Materials folder make use of the R project in the folder.
Click on the .Rproj file to open the R project in RStudio and then you can run any of the .Rmd files.
Note that our replication code includes .Rmd files for easy organization by chunks and so that individual chunks can be run, if desired.

Install packages if necessary:
packages <- c("rmarkdown", "skimr", "readr", "tidyverse", "gridExtra", "xtable", "stargazer",
"estimatr", "regrrr", "dotwhisker", "interplot", "sandwich", "ggpubr", "meta", "RColorBrewer", 
"rstatix", "cowplot")
install.packages(packages)

File packages-versions.html contain the package version information

Most recently run with the following version of R on Windows 11:
R version 4.2.1 (2022-06-23 ucrt) -- "Funny-Looking Kid"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

## -------------------------------------------------- #
#  folder structure
## -------------------------------------------------- #

├── README.txt           				   #readme file
├── data                                                   #folder containing both raw and processed data                                        
├── codebooks                                              #Codebooks with variable descriptions
├── Figures                                                #Empty folder as a placeholder for Figures created in .Rmd files
├── Tables                                                 #Empty folder as a placeholder for Tables created in .Rmd files                                            
├── IRB Letters                                            #IRB Letters for approvals
├── Questionnaires					   #Printed Qualtrics questionnaires
├── SM-Appendix						   #Supplemental Material and Appendix to Supplemental Materials following APSR guidelines	

The code files are in the root folder. See a description below. 

## -------------------------------------------------- #

Conducting the verification: 

Save the replication files locally, preserving the folder structure in the replication materials. The replication code assumes a certain folder (directory) structure. As long as the folders are in the R working directory the script will find these files and work properly. 

Please create/use the folder data within the directory to save the data files so the replication can be conducted. 

Open the directory in RStudio using .Rproject

Install packages if necessary:

	packages <- c("rmarkdown", "skimr", "readr", "tidyverse", "gridExtra", "xtable", "stargazer",
			"estimatr", "regrrr", "dotwhisker", "interplot", "sandwich", "ggpubr", "meta", "RColorBrewer", 
			"rstatix", "cowplot")

	install.packages(packages)

See file packages-versions.html for information on package versions and session info.

If you would like to save figures and tables locally, you need to:

1. Create a Figures folder (or use the provided empty folder provided)
2. Create a Tables folder (or use the provided empty folder provided)
3. Replace base_dir with your own file path (currently base_dir <- getwd()

## -------------------------------------------------- #

Files description:

The data folder contains the following files:
lucid_sample_2.23.21.rds - raw data for Study 1
lucid_sample_5.3.21.rds - raw data for Study 2
lucid_sample_study_3_10.25.21.rds - raw data for Study 3
prolific_sample_11.28.22.rds/ld4_raw.rds - raw data for Study 4
lucid_sample_11.28.22.rds - raw data for Study 5
df_clean.rds - cleaned data for Study 1
df_followup_clean.rds - cleaned data for Study 2
df_followup2_clean.rds - cleaned data for Study 3
df_study4_clean.rds - cleaned data for Study 4
df_study5_clean.rds - cleaned data for Study 5

Code:
01-study-1-clean.Rmd - uses lucid_sample_2.23.21.rds to produce df_clean.rds
02-study-2-clean.Rmd - uses lucid_sample_5.3.21.rds to produce df_followup_clean.rds
03-study-3-clean.Rmd - uses lucid_sample_study_3_10.25.21.rds to produce df_followup2_clean.rds
04-study-4-clean.Rmd - uses prolific_sample_11.28.22.rds to produce df_study4_clean.rds
05-study-5-clean.Rmd - uses lucid_sample_11.28.22.rds to produce df_study5_clean.rds
06-main-figures-tables.Rmd - uses df_clean.rds, df_followup_clean.rds, df_followup2_clean.rds, df_study4_clean.rds, and df_study5_clean.rds to produce all figures and tables in the manuscript (and tables for main manuscript analyses but included in SM and Online Appendix), except for Figure 1, which does not require statistical analysis
07-sm-figures-tables.Rmd - uses df_clean.rds, df_followup_clean.rds, df_followup2_clean.rds, df_study4_clean.rds, df_study5_clean.rds, and pilot_clean.RData to produce all figures and tables in the SM, except for those produced in file 09 described below. Also creates and uses ld4_raw.rds
08-main-figures-tables-alt.Rmd - uses df_clean.rds, df_followup_clean.rds, df_followup2_clean.rds to reproduce figures and tables for an alternative coding of respondent race/ethnicity and use of pre-treatment partisanship (serves as a robustness check, and produces no figures or tables used in the manuscript or SM)
09-copartisanship-partisanship.Rmd - uses df_clean.rds, df_followup_clean.rds, df_followup2_clean.rds, df_study4_clean.rds, and df_study5_clean.rds to produce figures and tables in the SM with alternative coding variations of copartisanship and partisanship
10-study-1-power.Rmd - MDE calculations for Study 1
11-study-2-power.Rmd - power calculations for Study 2
12-study-3-power.Rmd - power calculations for Study 3
13-studies-4-5-power.Rmd - power calculations for Studies 4 and 5


## -------------------------------------------------- #

Notes:

Part of the code is commented out when it requires PII data. Those commented out parts are not reproducible. 

We do not provide the code or the codebook for the pilot data (pilot_clean.RData) but the raw data and the code are available upon request. 




